<?php
namespace app\admin\controller;

use \think\Controller;

class Role extends Controller
{
    public function lists()
    {
        return $this->fetch();
    }

    public function add()
    {
        $data['field'] = 'id,role_name,level';
        $data['where'] = array('role_status'=>'0');
        $data['data'] = model('Role')->lists($data);
        $this->assign('data',$data['data']);
        return $this->fetch();
    }

    public function edit(){
        $data['field'] = 'id,role_name,level';
        $data['where'] = array('role_status'=>'0');
        $data['data']['lists'] = model('Role')->lists($data);
        $data['field'] = 'id,role_name,parent_id,level';
        $data['where'] = array('id'=>$this->request->param('id'));
        $data['data']['one_data'] = model('Role')->getOneData($data);
        $this->assign('data_lists',$data['data']['lists']);
        $this->assign('data_oneData',$data['data']['one_data']);
        return $this->fetch();
    }
}
